<?php

namespace App\Http\Controllers\CallingCards\Wechat;


use App\Http\Controllers\BaseController;
use App\Models\Common\ConfigModel;
use App\Service\CallingCards\ProductService;
use Illuminate\Support\Facades\Cache;

class ProductController extends BaseController
{
    // 串品分类列表
    public function index()
    {
        $json = Cache::remember('feishuCallingCards:products', now()->addMinute(), function () {
            return (string)ConfigModel::query()
                ->where('module', 'callingCards')
                ->where('name', 'products')
                ->value('value');
        });
        if (!strlen($json)) {
            $json = file_get_contents(resource_path('feishuCallingCards/products.json'));
        }
        return $this->success(json_decode($json, true));
    }
}
